home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Views / View.cp < prev    next >
Text File  |  1997-06-28  |  2KB  |  158 lines

  1. // View.cp
  2.  
  3. #ifndef View_h
  4. #include "View.h"
  5. #endif
  6. #ifndef Pane_h
  7. #include "Pane.h"
  8. #endif
  9. #ifndef RegionObject_h
  10. #include "RegionObject.h"
  11. #endif
  12. #ifndef ViewMap_h
  13. #include "ViewMap.h"
  14. #endif
  15.  
  16. View::View()
  17.   : owner( 0 )
  18.   {
  19.   }
  20.  
  21. View::~View()
  22.   {
  23.     if ( owner != 0 )
  24.         owner->ClearView();
  25.   }
  26.  
  27. bool View::Mapped() const
  28.   {
  29.     return owner != 0 && owner->Mapped();
  30.   }
  31.  
  32. void View::GainMapping()
  33.   {
  34.     Invalidate();
  35.   }
  36.  
  37. void View::LoseMapping()
  38.   {
  39.   }
  40.  
  41. void View::ChangeBounds( Rectangle )
  42.   {
  43.     Invalidate();
  44.   }
  45.  
  46. void View::Clip( RegionObject& region ) const
  47.   {
  48.     if ( owner == 0 )
  49.         region.BeEmpty();
  50.      else
  51.         owner->Clip( region );
  52.   }
  53.  
  54. TangibleView *View::Touch( PointObject )
  55.   {
  56.     return 0;
  57.   }
  58.  
  59. void View::Update() const
  60.   {
  61.     if ( !Mapped() )
  62.         return;
  63.     
  64.     ViewMap map( *this, ViewMap::invalidOnly );
  65.     Draw( map );
  66.     map.Validate();
  67.   }
  68.  
  69. void View::Update( const Rectangle& restriction ) const
  70.   {
  71.     if ( !Mapped() )
  72.         return;
  73.     
  74.     ViewMap map( *this, ViewMap::invalidOnly );
  75.     map.RestrictTo( restriction );
  76.     Draw( map );
  77.     map.Validate();
  78.   }
  79.  
  80. void View::Update( const RegionObject& restriction ) const
  81.   {
  82.     if ( !Mapped() )
  83.         return;
  84.     
  85.     ViewMap map( *this, ViewMap::invalidOnly );
  86.     map.RestrictTo( restriction );
  87.     Draw( map );
  88.     map.Validate();
  89.   }
  90.  
  91. void View::Redraw() const
  92.   {
  93.     if ( !Mapped() )
  94.         return;
  95.     
  96.     ViewMap map( *this, ViewMap::includeInvalid );
  97.     
  98.     if ( !map.Visible() )
  99.         return;
  100.     
  101.     Draw( map );
  102.     map.Validate();
  103.   }
  104.  
  105. void View::Redraw( const Rectangle& restriction ) const
  106.   {
  107.     if ( !Mapped() )
  108.         return;
  109.     
  110.     ViewMap map( *this, ViewMap::includeInvalid );
  111.     map.RestrictTo( restriction );
  112.     
  113.     if ( !map.Visible() )
  114.         return;
  115.  
  116.     Draw( map );
  117.     map.Validate();
  118.   }
  119.  
  120. void View::Redraw( const RegionObject& restriction ) const
  121.   {
  122.     if ( !Mapped() )
  123.         return;
  124.     
  125.     ViewMap map( *this, ViewMap::includeInvalid );
  126.     map.RestrictTo( restriction );
  127.     
  128.     if ( !map.Visible() )
  129.         return;
  130.  
  131.     Draw( map );
  132.     map.Validate();
  133.   }
  134.  
  135. void View::Invalidate() const
  136.   {
  137.     if ( !Mapped() )
  138.         return;
  139.     
  140.     ViewMap( *this, ViewMap::includeInvalid ).Invalidate();
  141.   }
  142.  
  143. void View::Invalidate( const Rectangle& restriction ) const
  144.   {
  145.     if ( !Mapped() )
  146.         return;
  147.     
  148.     ViewMap( *this, ViewMap::includeInvalid ).Invalidate( restriction );
  149.   }
  150.  
  151. void View::Invalidate( const RegionObject& restriction ) const
  152.   {
  153.     if ( !Mapped() )
  154.         return;
  155.     
  156.     ViewMap( *this, ViewMap::includeInvalid ).Invalidate( restriction );
  157.   }
  158.